home *** CD-ROM | disk | FTP | other *** search
/ Freelog 38 / Freelog038.iso / Bas / Bureautique / Ntl480 / Setup.exe / {app} / Libraries / CaptureLinks.clb < prev    next >
Text File  |  2002-06-10  |  6KB  |  114 lines

  1. = V5 MultiLine NoSorting TabWidth=30
  2.  
  3. H=";About this library"
  4. This Clipbook library demonstrates how text can be captured from the Windows Clipboard and used in a document. It optionally uses spoken messages to indicate what it is doing in the background. You can download these message sound files by double-clicking on the "Download sounds" Clip.
  5.  
  6. To try this feature, open a new document and then launch your web browser, pointing it to a page with links (for example http://www.notetab.com/links.htm). Once the page is displayed, double-click on the "Start" Clip to activate the capture mode. Two capture methods are available. A Clip wizard will prompt you to choose one of them (see explanation below). You also have the choice of storing the captured links in the current document or in a new web page.
  7.  
  8. 1) "Prompt for URL description" method: Copy the URL of a link (browser shortcut menu: "Copy Link Location" in Netscape and "Copy Shortcut" in Internet Explorer). If NoteTab detects that a URL has been copied to the Clipboard, it will come to the front and prompt you to enter a description for the link, after which it will move out of the way again.
  9.  
  10. 2) "All information from Clipboard" method: First copy the URL of a link (browser shortcut menu: "Copy Link Location" in Netscape and "Copy Shortcut" in Internet Explorer), and then copy the information text that describes the link. Continue this procedure by alternating between URL and link description until you've had enough. Take a look at your NoteTab document and you will see perfectly HTML-formatted links.
  11.  
  12. Double-click on the "Stop" Clip or close the library when you have finished capturing links, otherwise any text you copy to the Clipboard will continue to be pasted into NoteTab.
  13.  
  14.  
  15. H=";"
  16.  
  17.  
  18. H="Start"
  19. ;Show Clip wizard and ask user which capture method to use and whether to create a new document
  20. ^!Set %PromptDescription%=^?[Choose capture method==_Prompt for URL description^=True|All information from Clipboard^=False]; %NewDoc%=^?[Place captured links in...==_New document^=True|Current document^=False]
  21. ;Set initial values for main variables
  22. ^!Set %CheckClipboard%=True; %PasteInfo%=0
  23. ;If user does not want to create a new document, skip this procedure
  24. ^!IfFalse ^%NewDoc% SkipNewDoc
  25.  
  26. ;Create a new document with specified name for web page
  27. ^!Set %KeepNameFormat%=^$GetNameFormat$
  28. ^!SetNameFormat Links%0.2d.html
  29. ^!Toolbar New Document
  30. ^!SetNameFormat ^%KeepNameFormat%
  31. ;Add header and title information for new web page
  32. ^!InsertHtml <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">^P<HTML>^P<HEAD>^P<TITLE>^?{Web page title=Favorite Links}</TITLE>^P<META name="generator" content="^$GetProgName$ ^$GetProgVersion$">^P</HEAD>^P<BODY>^P^P
  33. ;Store position of cursor
  34. ^!Set %TextPos%=^$GetRow$
  35. ;Add closing tags for end of web page
  36. ^!InsertHtml ^P^P<P>Created on ^$GetDate(mmmm dd, yyyy)$</P>^P</BODY>^P</HTML>^P
  37. ;Move the cursor back to the saved position
  38. ^!SetCursor ^%TextPos%:1
  39.  
  40. :SkipNewDoc
  41. ^!Prompt Capture mode is now enabled
  42.  
  43. H="Stop"
  44. ;Stop checking the Windows Clipboard
  45. ^!Set %CheckClipboard%=False
  46. ^!Prompt Clipboard capturing stopped. Double-click on the "Start" Clip if you want to continue
  47.  
  48. H=";"
  49.  
  50.  
  51. H="Open Links web page"
  52. ^!Continue This Clip will connect your web browser to the page http://www.notetab.com/links.htm. Continue?
  53. ^!URL http://www.notetab.com/links.htm
  54.  
  55. H="Download sounds"
  56. ^!Continue This command will activate your web browser and download the sample sound files used in this library. Continue?
  57. ^!URL http://www.notetab.com/ftp/clipwavs.zip
  58. ^!INFO Once the file has been downloaded to your computer, just unzip its content into the following subdirectory: "^$GetSoundPath$"
  59.  
  60. H=";"
  61.  
  62.  
  63. H="_OnOpen"
  64. ;Check if this library has been opened before. If it has, skip the instructions below
  65. ^!If ^$GetValue(efoCaptureLinks)$ = 1 Exit
  66. ;Save key value to NoteTab's INI file
  67. ^!SaveValue efoCaptureLinks=1
  68. ;Show instructions contained in the "About this library" Clip
  69. ^!Clip "About this library"
  70.  
  71. H="_OnClipboardChange"
  72. ;If we are not supposed to check the Windows Clipboard, end this Clip
  73. ^!IfFalse ^%CheckClipboard% End
  74. ;If the size of the text in the Clipboard exceeds 255 characters, end this Clip (unlikely to be data for a link)
  75. ^!If ^$GetClipboardSize$ > 255 End
  76. ;Copy Clipboard text into a variable
  77. ^!Set %ClipboardText%=^$GetClipboard$
  78. ;Check which capture method was chosen by user. If user wants to type URL description, Jump to PromptInfo label
  79. ^!IfTrue ^%PromptDescription% PromptInfo
  80.  
  81. ;Chosen capture method is "All information from Clipboard"
  82. ;Check if Clipboard text should contain URL or description text. If we already have the URL part, paste the description, otherwise jump to the AddUrl label
  83. ^!IfTrue ^%PasteInfo% Next ELSE AddUrl
  84. ;Set the PasteInfo variable to 0 to indicate that the next text copied to the Clipboard should correspond to a URL
  85. ^!Set %PasteInfo%=0
  86. ;Insert link description and end of tag into the document
  87. ^!InsertHtml ^$StrTrim("^%ClipboardText%")$</A><BR>^P
  88.  
  89. ;Play sound file if it exists
  90. ^!Sound ^$GetSoundPath$SayInfo.wav
  91. ;End the Clip
  92. ^!Goto End
  93.  
  94. :AddUrl
  95. ;Set the PasteInfo variable to 1 to indicate that the next text copied to the Clipboard should correspond to a link description
  96. ^!Set %PasteInfo%=1
  97. ;Insert start of tag and URL into the document
  98. ^!InsertHtml <A HREF="^$StrTrim("^%ClipboardText%")$">
  99. ;Play sound file if it exists
  100. ^!Sound ^$GetSoundPath$SayUrl.wav
  101. ;End the Clip
  102. ^!Goto End
  103.  
  104. :PromptInfo
  105. ;If text from Clipboard is not a URL, end this Clip
  106. ^!IfFalse ^$IsUrl("^%ClipboardText%")$ End
  107. ;Bring NoteTab to the front
  108. ^!ActivateApp
  109. ;Show Clip wizard prompting user to enter the URL description, then insert the link tag into the document
  110. ^!InsertHtml <A HREF="^%ClipboardText%">^?{Enter URL description}</A><BR>^P
  111.  
  112. ;Minimize NoteTab
  113. ^!MinimizeApp
  114.